/**
Nectarine Utility Project is a software interface for the web system 'demovibes'
Copyright (C) 2010  Alexandre LAURENT

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

website: http://code.google.com/p/nectarine-utility-project/
e-mail: lw.demoscene@gmail.com
**/

#include "status.h"

#include <QString>

#include <QDebug>

Status statusFactory(const QString& name)
{
    if ( name == "Active" )
    {
        return S_ACTIVE;
    }
    else if ( name == "Rejected" )
    {
        return S_REJECTED;
    }
    else if ( name == "Dupe" )
    {
        return S_DUPE;
    }
    else if ( name == "Inactive")
    {
        return S_INACTIVE;
    }
    else if ( name == "Jingle" )
    {
        return S_JINGLE;
    }
    else
    {
        qDebug() << "statusFactory doesn't implement this: " << name;
        return S_ACTIVE;
    }
}

QString statusToString(const Status state)
{
    switch (state)
    {
        case S_ACTIVE:
            return QString("Active");
            break;
        case S_REJECTED:
            return QString("Rejected");
            break;
        case S_DUPE:
            return QString("Dupe");
            break;
        case S_INACTIVE:
            return QString("Inactive");
            break;
        case S_JINGLE:
            return QString("Jingle");
            break;
    }

    return QString("");
}

UserStatus usFactory(const QString& status)
{
    if ( status == "User" )
    {
        return US_USER;
    }
    else if ( status == "Staff" )
    {
        return US_STAFF;
    }
    else if ( status == "Admin" )
    {
        return US_ADMIN;
    }
    else
    {
        qDebug() << "usFactor doesn't implement this: " << status;
        return US_USER;
    }
}

QString usToString(const UserStatus status)
{
    switch (status)
    {
        case US_USER:
            return QString("User");
            break;
        case US_STAFF:
            return QString("Staff");
            break;
        case US_ADMIN:
            return QString("Admin");
            break;
    }

    return QString("");
}
